package com.hyh.spring.controller;

import com.hyh.spring.common.Result;
import com.hyh.spring.model.Payment;
import com.hyh.spring.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @BelongsPackage: com.hyh.spring.controller
 * @ClassName OrderFeignController
 * @Author: hyhWTX
 * @CreateTime: 2023-04-13  21:46
 * @Description: TODO (一句话描述以下该类的功能)
 * @Version: 1.0
 */
@RestController
@Slf4j
public class OrderFeignController {
    @Autowired
    private PaymentFeignService paymentFeignService;
    @GetMapping(value = "/consumer/payment/get/{id}")
    public Result<Payment> getPaymentById(@PathVariable("id")Long id){
        return paymentFeignService.getPaymentById(id);
    }
    @GetMapping(value = "/consumer/payment/feign/timeout")
    public String paymentFeignTimeout(){
        // OpenFeign客户端一般默认等待1秒钟
        return paymentFeignService.paymentFeignTimeout();
    }
}
